From dfa275f7d929ad342e0844e155286432b6f6c197 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 13 Aug 2009 08:40:39 +0100 Subject: [PATCH] gdbstub: Fix the build and make a few cleanups. Signed-off-by: Keir Fraser --- xen/common/gdbstub.c | 15 +++++++-------- xen/include/xen/gdbstub.h | 6 ------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c index 512172a1aa..a345fa797c 100644 --- a/xen/common/gdbstub.c +++ b/xen/common/gdbstub.c @@ -71,15 +71,14 @@ string_param("gdb", opt_gdb); static void gdbstub_console_puts(const char *str); /* value <-> char (de)serialzers */ -char +static char hex2char(unsigned long x) { const char array[] = "0123456789abcdef"; - return array[x & 15]; } -int +static unsigned int char2hex(unsigned char c) { if ( (c >= '0') && (c <= '9') ) @@ -93,13 +92,13 @@ char2hex(unsigned char c) return -1; } -char +static unsigned char str2hex(const char *str) { return (char2hex(str[0]) << 4) | char2hex(str[1]); } -unsigned long +static unsigned long str2ulong(const char *str, unsigned long bytes) { unsigned long x = 0; @@ -116,7 +115,7 @@ str2ulong(const char *str, unsigned long bytes) return x; } -unsigned long +static unsigned long str_to_native_ulong(const char *str) { unsigned long x = 0, i = 0; @@ -125,9 +124,9 @@ str_to_native_ulong(const char *str) { #ifdef __BIG_ENDIAN x <<= 8; - x += str2hex(*str); + x += str2hex(str); #elif defined(__LITTLE_ENDIAN) - x += (unsigned long)str2hex(*str) << (i*8); + x += (unsigned long)str2hex(str) << (i*8); #else # error unknown endian #endif diff --git a/xen/include/xen/gdbstub.h b/xen/include/xen/gdbstub.h index e87cf30470..e9f0cd5a27 100644 --- a/xen/include/xen/gdbstub.h +++ b/xen/include/xen/gdbstub.h @@ -26,12 +26,6 @@ #ifdef CRASH_DEBUG -/* value <-> char (de)serialzers for arch specific gdb backends */ -char hex2char(unsigned long x); -int char2hex(unsigned char c); -char str2hex(const char *str); -unsigned long str2ulong(const char *str, unsigned long bytes); - struct gdb_context { int serhnd; /* handle on our serial line */ int console_steal_id; /* handle on stolen console */ -- 2.30.2